package com.aistar.controller;

import com.aistar.service.ProductReviewService;
import com.aistar.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class ReviewController {


    @Autowired
    private ProductReviewService productReviewService;




    @GetMapping("/review/getByPage")
    @ResponseBody
    private ServerResponse getByPage(Integer page){
       ServerResponse serverResponse = productReviewService.getByPage(page);
       return serverResponse;

    }
    @GetMapping("/addReviewCount")
    @ResponseBody
    private ServerResponse addReviewCount(Integer id){
        ServerResponse serverResponse = productReviewService.addCountById(id);
        return serverResponse;

    }
    @GetMapping("/reduceReviewCount")
    @ResponseBody
    private ServerResponse reduceReviewCount(Integer id){
        ServerResponse serverResponse = productReviewService.reduceCountById(id);
        return serverResponse;

    }
}
